Real World Interface for your Apple //
By Dominic Cioccarelli
Copyright (c) 1991 Apple Users' Group, Sydney
Republished from Applecations, a publication of the Apple Users' Group, Sydney, Australia.


In 1977, the Apple II was released on a large scale. One of the main reasons why it was successful where others had failed was because of its open architecture, both in hardware and firmware. This open architecture in respect to hardware enables anyone to develop peripherals to adapt their Apple to their own specific needs. Over the last five years, I have noticed a tendency among apple users to only use their machines for applications such as word processing, spreadsheets or games. While I do not condemn this, and I concede that this practice is far more prevalent in the IBM/ Macintosh/ Commodore worlds, I must say that by doing this, people are loosing some of the greatest features of the Apple //, its versatility. As a result of this, over the next few months I hope to present a number of add on cards which will work over the whole Apple // spectrum (except for the //c, sorry!), and expand these great machines to enable users to maximize the potential of their machines.
This month, the construction project is one of the most invaluable and versatile cards that can be constructed, an 8 bit input/output card (I/O card). This device can be used for anything from a computerized burglar alarm to controlling household appliances to watering the garden to controlling a bank of printers to programming the video. As you can see, the possibilities are limitless.
Picture this scenario. You are going to be late home, so you call your computer at home from your PC at work. Your auto answer modem answers the phone, and you are confronted with a menu on the screen of your PC. First you decide to check if your house has been broken into, nope. Now you check if there have been any phone calls, yes, 6 of them. It was a hot day, so you decide to turn your automatic watering system on for an hour, and you set your air conditioner to turn on half an hour before you get home so the house will be nice and cool. You remember that you will miss your favorite TV program, so you set the video recorder to record it, and while you are at it, you set your oven to pre-heat to 230 C.
As you can see, virtually anything is possible with a properly configured I/O card. So what is an I/O card you ask? Simply speaking, it is a card which provides a number of computer controlled inputs, and outputs. The card described in this article can have from 0 to 32 inputs, and 0 to 32 outputs. This is plenty for most needs, though more can be added if necessary with a few modifications.
In my description of the construction of the project, I am going to be very brief. The reason for this is that I can not hope to cover the scope of electronic construction in the context of this article. For this reason, a medium knowledge of electronics will be needed to attempt this project. The circuit diagram for the card can be seen in figure 1. The circuit should be constructed on an Apple prototype card. These cards are available from Hi-Com Unitronics or Radiospares in Australia or at a cheaper price from Jameco electronics in the US. The addresses for these companies will be given at the end of the article.
As mentioned earlier, the card may have from 0 to 32 inputs, and the same goes for outputs. The card I am discussing here has 8 inputs and 8 outputs. If you wish to have a different set up, you can configure this through use of more input circuits or more output circuits (figures 2 and 3). Each circuit has 8 inputs or 8 outputs respectively. For the first set of inputs the enable line should be connected to pin 14 of the 74LS138, the second set of inputs should be connected to pin 12 etc, i.e. IN 2, IN 3 IN 4. The output sets should be connected in a similar fashion, i.e. first set of outputs goes to pin 15, next to pin 13 etc.

Construction of 8 input/ 8 output card.
The 6 chips should be placed in IC sockets, and these should be soldered in first. They should be placed evenly around the board so that the wiring is not cluttered. The only other component on the board is the resistor, and it should be soldered in next. Now connect the chips together and to their respective connectors as shown in the circuit diagram (figure 1). The best wire to use for this is the type used in telephone switchboards. This can be obtained from Jaycar electronics (zCat no. WH-3027 ). The connections to the 25 pin D connector should be soldered to the far end of the board before being connected to the actual connector to reduce the chances of damaging a chip by an inadvertent pull on the 25 pin D connector. That is, they should be connected something like this:-

                           Edge of card,
                         solder here first
                                 |
                                 v

         ------------------------X----------|
From     ------------------------X----------|  25 pin
IC's     ------------------------X----------|D connector
         ------------------------X----------|

To enable DMA and INT access by other cards, pin 24 should be connected to pin 27 and pin 23 should be connected to pin 28 on the 50 pin edge connector.
The pins for the 50 pin Apple Bus should be printed on the protoboard, or at least pins 1, 25, 26, 50 should be marked and the others can be derived from these. If you have a card without any markings, you should be able to work out which pins are which from the diagram of the Apple Bus that I have provided. The IC's can now be placed in their respective sockets, and the card can be placed in an empty socket in the mother board. For the IIgs, I recommend using slot 4, as when using the card, the slot will have to be set as "your card". The reason for using slot 4 is that I find the mouse is the peripheral I can most easily do without whilst using the card. Of course, you can always disable the I/O card when using the mouse. The 25 pin D connector (by the way it should be a socket), should now be screwed in place in the rear panel of the computer. Note: II and II+ owners should either make a suitable mounting bracket for the connector, or can just leave it 'dangling', though if this option is taken, care must be taken that the socket is never pulled.
Now you should turn your computer on and test if everything is OK. If so, good for you. If not, turn the power off quickly, carefully remove the card, and re-check all the connections against the circuit diagram very carefully. Also look for possible bad solder connections.
Now that you have the card installed, it won't do much, nothing at all actually. You can see though, by looking at table 2, that the 25 pin D connector comprises of two power lines (+5v and GND), 8 inputs, and 8 outputs. These are not powerful enough to do anything much by themselves, so another device or devices are needed to control objects such as lights. At the moment these lines are only at logic level, but can be used to control TTL or CMOS circuits. I have included several circuits, the first two to test the interface, the others practical circuits to accomplish various tasks.
To use these circuits, you will need a male 25 pin D connector with a backshell to connect to the socket of the I/O card. A cable can then be soldered to this, and the other end of the cable to the circuit board of the desired input or output device. I recommend constructing the circuits on either veroboard or matrix board. A power supply may be needed for some of the circuits, and if this option is adopted, the ground line of the power supply should be connected to the ground line of the I/O card.

Programming
Programming is relatively straightforward, and will only be discussed briefly. The addresses for the various inputs and outputs is shown in table?. e.g. To read an input from the first set of inputs when the card is in slot 4.

10 X=PEEK(49344)
20 PRINT X

X will be a number from 0 to 255, and will correspond to the binary input to the first set of inputs of the card in slot 4. You will have to convert this number to binary to make any sense of it. For example, if X was 128, this would mean that its binary equivalent would be 10000000, which would in turn mean that the last input was on. Similarly 1 would be 00000001 which would mean that the first input was on, and 96 would be 01100000 which would mean that the 6th and 7th inputs were on.

To output a number,

10 X= number
20 POKE 49344,X

So, if you wanted to turn output 1 on, you would make X=1 (00000001). If you wanted to turn output 8 on, X would equal 128 (10000000), or to turn the 6th and 7th outputs on, you would make X equal to 96 (01100000).
Good luck with the circuit, and if you have any problems, feel free to contact me on (02) 634-6864. One other thing, I will not accept any responsibility for any damage which you may intentionally or inadvertently cause to your computer, for obvious reasons.









List of Parts

Description          Quantity             Supplier           Cat No.

74LS245                      2                    Jaycar             ZS-5245
74LS75                       2                    Jaycar             ZS-5075
74LS04                       1                    Jaycar             ZS-5004
270 ohm resistor             1                    Jaycar             RR-1560
25 pin D female connector      1                    Jaycar             PS-0844
Single Core Hook up Wire      1                    Jaycar             WH-3027
Protoboard                           SEE TEXT

Suppliers addresses:-

Jaycar electronics
117 York Street Sydney
(02) 745-3077
Cnr Victoria Rd & Church St Parramatta
(02) 683-3377

Hi-Com Unitronics
7 President Avenue Caringbah
(02) 524-7878

Radiospares Components
Sydney
(02) 669-3666

Jameco Electronics
1355 Shoreway Rd
Belmont, California 94002

THIS CONTENT COPYRIGHT © 2007, APPLE MACINTOSH USERS' GROUP, SYDNEY
Permission has been obtained to make this material available on the Internet.

Permission is hereby granted for non-profit user groups to republish this content.
PLEASE CREDIT THE AUTHOR AND THE SOURCE: Applecations, publication of the Apple Users' Group, Sydney, Australia

THIS PAGE COPYRIGHT © 2012, ANDREW ROUGHAN